public class CiShu {

	public static void main(String[] args) {
		String a = "this is dog";
		String b = "dog";
		int Ci = 0;
		for (int i = 0; i < a.length(); i++) {
			int c = a.indexOf(b, i);
			if (c != -1) {
				Ci++;
				i = c;
			}
			System.out.println(Ci);
		}
	}

}
